<div class="breadcrumbs" id="breadcrumbs">
    <ul class="breadcrumb">
        <li>
            <i class="icon-home home-icon"></i>
            <a href="#">财务管理</a>
        </li>

        <li>
            <a href="#">数据统计</a>
        </li>
    </ul>
    <div>
        <input type="hidden" id="cupage" value="1"/>
        <input type="hidden" id="total" value="1"/>
        <input type="hidden" id="formurl" value="/manager/money/getDataCountPage"/>
        <input type="hidden" id="startTime" name="startTime" value=""/>
        <input type="hidden" id="endTime" name="endTime" value=""/>
        <input type="hidden" name="user_id" id="user_id"/>
    </div>
</div>

<div class="page-content">
    <div class="row">
        <div class="col-xs-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        <i class="icon-reorder"></i>
                        筛选条件
                    </h3>
                </div>
                <div class="panel-body">
                    <form class="form-horizontal">
                        <label for="date1" class="col-sm-1 control-label">日期:</label>
                        <div class="col-md-2">
                            <input type="text" name="regular" class="form-control datepicker" id="date1" onBlur="onb()">
                        </div>
                        <div class="col-md-1">
                            <input type="button" id="btn-load" class="btn btn-primary btn-pikaqiu"
                                   data-loading-text="加载中..." value="查 询"/>
                        </div>
                    </form>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        <i class="icon-reorder"></i>
                        数据统计列表
                    </h3>
                </div>
                <div class="panel-body">
                    <div class="table-responsive">
                        <table id="sample-table-2" class="table table-striped table-bordered table-hover">
                            <thead>
                            <tr>
                                <th>日期</th>
                                <th>当日注册用户</th>
                                <th>当日推广数量</th>
                                <th>当日有效推广数量</th>
                                <th>当日收入</th>
                                <th>当日支出</th>
                                <th>当日收益</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody id="loadData">

                            </tbody>
                        </table>
                        <!--#include file="/admin/include/page.html"-->
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $("#btn-load").on("click", function () {
        var a = $(this);
        a.button("loading");
        $("#cupage").val("1");
        loadData();

    });
    initDate();
    function loadData() {
        var para = {
            curPage: $("#cupage").val(),
            startTime: $("#startTime").val(),
            endTime: $("#endTime").val()
        };
        loadGetServer($("#formurl").val(), para, function (data) {
            var $loadData = $("#loadData");
            $loadData.html("");
            var list = data.page.list;
            var html_ = "";
            for (var i = 0; i < list.length; i++) {
                html_ += "<tr><td>" + list[i].time + "</td><td>" + list[i].user_count + "</td>";
                html_ += "<td>" + list[i].apply_count + "</td><td>" + list[i].effective_count + "</td><td>" + list[i].in_money + "</td>";
                html_ += "<td>" + list[i].out_money + "</td><td>" + list[i].money + "</td><td>" + list[i].create_date + "</td>";
                html_ += "<td><div class='hidden-sm hidden-xs btn-group'>";
                html_ += "<button class='btn btn-xs btn-info' title='重新统计' onclick='showCountDataAgainConfirm(\"" + list[i].time + "\")'><i class='icon-refresh bigger-120'></i>重新统计</button>";
                html_ += "</td></tr>";
            }
            $loadData.html(html_);
            pageValue(data);
            pageData();
            $("#btn-load").button("reset");
        });
    }

    loadData();

    function countDataAgain(time) {
        var para = {
            time: time
        };
        loadGetServer('/manager/money/countDataAgain', para, function (data) {
            alert(data.msg);
            loadData();
        });
    }

    function showCountDataAgainConfirm(time) {
        var r = confirm("是否重新统计当日数据？");
        if (r == true) {
            countDataAgain(time);
        }
    }
</script>